package com.bestcem.xm.common.core.algorithm;

import java.io.ByteArrayInputStream;

/**
 * @author jy.zhao
 * @version 2022/2/28 16:26
 * @date 2021/8/5 17:19
 **/
public class BinaryId extends ByteArrayInputStream implements Comparable<BinaryId> {

    private final int hashcode;

    public BinaryId(byte[] buf) {
        super(buf);
        this.hashcode = new String(buf).hashCode();
    }

    @Override
    public int compareTo(BinaryId binaryId) {
        return binaryId.hashCode();
    }

    @Override
    public int hashCode() {
        return hashcode;
    }
}
